package demo3;

import java.util.Scanner;

public class Tese {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();

        for (int i = 2; i <= num; i++) {

            int baiwei = i/100;
            int shiwei = (i%100)/10;
            int gewei = (i%100)%10;
            if(i==(baiwei*baiwei*baiwei)+(shiwei*shiwei*shiwei)+(gewei*gewei*gewei)){
                System.out.println(i);
            }
        }

    }
}
